<?php

/*
 * This file belongs to Techno Web Solutions :: http://technowebsol.com
 */

/**
 * Description of loader
 * Sep 13, 2012
 * File: loader.php
 * Encoding: UTF-8
 * Project: fbClone
 *
 * @author Suman Choudhury <suman@technowebsol.com>
 */
class Loader extends Base{
    public $config = array();
    function __construct() {
        parent::__construct();
        $config = array();
        $content = file_get_contents(CONFIG_PATH."autoload.php");
        $content = str_replace("<?php", "", $content);
        $content = str_replace("<?", "", $content);
        $content = str_replace("?>", "", $content);
        eval($content);
        $this->config->autoload = $config;
        $config = array();
        if(!empty($this->config->autoload['config'])){
            foreach($this->config->autoload['config'] AS $val){
                $content = file_get_contents(CONFIG_PATH.$val.EXT);
                $content = str_replace("<?php", "", $content);
                $content = str_replace("<?", "", $content);
                $content = str_replace("?>", "", $content);
                eval($content);
                $this->config->$val = $config;
                $config = array();
            }
        }

        /*if(!empty($config['library'])){
            foreach($config['library'] AS $val){
                //not need
            }
        }*/

        //pr($this);

        $this->db = new DB($this->config->database['host'], $this->config->database['user'], $this->config->database['pass'],
                $this->config->database['dbName'], $this->config->database['port'], $this->config->database['dbPrefix']);
    }

}
?>
